package com.hyou.demos.rabbitmq.recive;

import javax.annotation.Resource;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

@Component("reciver")
public class Reciver {
    
    @Resource
    private RabbitTemplate rabbitTemplate;
    
    public String reciveMsg(String queueName) {
        byte[] body = rabbitTemplate.receive(queueName).getBody();
        return new String(body);
    }
    
}
